package com.nb.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import lombok.Builder;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 操作日志实体类
 */
@Data
@Builder
@Table(value = "sys_log",dataSource = "primaryDS")
public class SysLog {

    /**
     * 日志ID
     */
    @Id(keyType = KeyType.Auto)
    @Column(value = "id")
    private Long id;

    /**
     * 操作用户ID
     */
    @Column(value = "user_id")
    private Long userId;

    /**
     * 操作类型（如：DELETE_USER）
     */
    @Column(value = "action")
    private String action;

    /**
     * 操作对象类型（如：user）
     */
    @Column(value = "target_type")
    private String targetType;

    /**
     * 操作对象ID
     */
    @Column(value = "target_id")
    private Long targetId;

    /**
     * 变更详情（旧值/新值）
     */
    @Column(value = "detail")
    private String detail;  // 使用String类型存储JSON数据

    /**
     * 操作IP
     */
    @Column(value = "ip")
    private String ip;

    /**
     * 操作时间
     */
    @Column(value = "created_time")
    private LocalDateTime createdTime;
}